﻿using DevExpress.XtraPrinting.Native;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace CompanyManageSystem.DLL
{
    public static class LinqHelper
    {
        public static IQueryable<T> WhereIf<T>(this IQueryable<T> src, bool flag, Expression<Func<T, bool>> where)
        {
            return (flag ? src.Where<T>(where) : src);
        }

        public static IEnumerable<T> WhereIf<T>(this IEnumerable<T> src, bool flag, Func<T, bool> where)
        {
            return (flag ? src.Where<T>(where) : src);
        }

        //public static string Join<T>(this IEnumerable<T> src, string separator)
        //{
        //    return string.Join(separator, (IEnumerable<string>)(from p in src select p.ToString()));
        //}




    }
}
